 %include header libraryName=libraryName
    <script type="text/javascript">
        //<!--
        $(document).ready(function() {
            $('#search_box').focus();
        })
        //-->
    </script>
    <div class="numResources">
        There are currently {{len(resources)}} {{'overdue' if overdue else 'checked out'}} resources
    </div>
    
    <a href="/administration">Administration Home</a>
    %if resources:
    <div class="bordered">
        <h2>{{'Overdue' if overdue else 'Checked Out'}} Resources</h2>
        <hr />
        %resourceAvailability=dict([(res['id'], False) for res in resources])
        <table width="100%">
            <thead>
                <tr>
                    <th>Title</th>
                    <th>Type</th>
                    <th>Due Date</th>
                    <th>Borrower</th>
                    %if not overdue:
                    <th>Overdue</th>
                    %end
                    <th></th>
                </tr>
            </thead>
            <tbody>
            %for i, resource in zip(range(len(resources)), resources):
                <tr>
                  <td>{{resource.get('title', '').encode('utf-8')}}</b></td>
                  <td>{{resourceTypes[resource.get('resource_type_id', '')].encode('utf-8')}}</td>
                  <td>{{resource.get('due_date').strftime('%x')}}</td>
                  <td>{{resource.get('card_name').encode('utf-8')}}</td>
                  %if not overdue:
                  <td class="{{'out' if resource.get('overdue') else 'in'}}">
                    {{'Yes' if resource.get('overdue') else 'No'}}
                  </td>
                  %end
                  <td><a href="/administration/checkedOut?checkIn={{resource['id']}}"><button>Check in</button></a></td>
                </tr>
                <!-- Might put some more stuff (such as e-mail the borrower) in an expandable div in the future -->
            %end
            </tbody>
        </table>
    </div>
    %end
%include footer